<template>
  <div>
    <el-form ref="formRef" :model="form">
      <div class="inlineCss">
        <el-form-item label="职业工种">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="职业等级">
          <el-input v-model="form.sex"></el-input>
        </el-form-item>
      </div>
      <el-form-item label="标准电子照片">
        <div>
          <el-upload
            list-type="picture-card"
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" />
            <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
          </el-upload>
          <span class="imgtext"
            >白底一寸彩照,命名格式:姓名-身份证号,不大于20kb</span
          >
        </div>
      </el-form-item>
      <el-form-item label="考生详细信息">
        <div>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
      <el-form-item label="鉴定申请表">
        <div>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
      <el-form-item label="身份证明">
        <div>
          <div style="display: flex; gap: 20px">
            <el-upload
              list-type="picture-card"
              class="upload-demo"
              action="/api/upload"
              :file-list="form.imageUrl"
            >
              <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" />
              <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
            </el-upload>
            <el-upload
              list-type="picture-card"
              class="upload-demo"
              action="/api/upload"
              :file-list="form.imageUrl"
            >
              <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" />
              <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
            </el-upload>
          </div>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
      <el-form-item label="学历证明">
        <div>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
      <el-form-item label="工龄证明">
        <div>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { reactive, ref, toRefs } from "vue";
import { Plus } from "@element-plus/icons-vue";
const props = defineProps({
  leftClick: Number,
});
const formRef = ref();
const state = reactive({
  form: {},
});

let { form } = toRefs(state);

const submitForm = () => {
  formRef.value.validate((valid) => {
    if (valid) {
      console.log("提交表单:", form.value);
    }
  });
};
</script>

<style lang="scss" scoped>
.inlineCss {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;

  .el-form-item {
    flex: 1;
    min-width: 200px;
  }
}

.el-form-item {
  margin-bottom: 22px;
}
.imgtext {
  font-size: 12px;
  color: #999;
}
</style>
